﻿@model ExamPlat.Models.ExamQues
@{
    ViewBag.Title = "Edit";
}
<div>@Html.ActionLink("返回列表", "Index", new { searchTitle = ViewBag.SearchTitle })</div>
<div>
    <br />
    <form action="/ExamQues/Edit" method="post" onsubmit="return Check()">
        @Html.HiddenFor(c => c.ID)
        <table>
            <tr>
                <td style="width:120px;">考题题目</td>
                <td><input type="text" name="ExamQuesTitle" id="ExamQuesTitle" value="@Model.ExamQuesTitle" /></td>
                <td><span style="color:red;" id="spanExamQuesTitle"></span></td>
            </tr>
            <tr>
                <td>考试时长(分钟)</td>
                <td><input type="text" name="ExamQuesTime" id="ExamQuesTime" value="@Model.ExamQuesTime" /></td>
                <td><span style="color:red;" id="spanExamQuesTime"></span></td>
            </tr>
            <tr>
                <td>每道单选题分数</td>
                <td><input type="text" name="SingleScore" id="SingleScore" value="@Model.SingleScore" /></td>
                <td><span style="color:red;" id="spanSingleScore"></span></td>
            </tr>
            <tr>
                <td>每道多选题分数</td>
                <td><input type="text" name="MultipleScore" id="MultipleScore" value="@Model.MultipleScore" /></td>
                <td><span style="color:red;" id="spanMultipleScore"></span></td>
            </tr>
            <tr>
                <td>每道对错题分数</td>
                <td><input type="text" name="JudgeScore" id="JudgeScore" value="@Model.JudgeScore" /></td>
                <td><span style="color:red;" id="spanJudgeScore"></span></td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:right;"><input type="submit" id="btnSave" value="保存" class="btn btn-primary" /></td>
                <td></td>
            </tr>
        </table>
    </form>
    <div class="msg">@ViewBag.Msg</div>
    <div><input type="hidden" name="searchTitle" value="@ViewBag.SearchTitle" /></div>
</div>
<script type="text/javascript">
    function Check() {
        var flag = true;
        var examQuesTitle = $("#ExamQuesTitle").val();
        if (examQuesTitle.trim().length == 0) {
            $("#spanExamQuesTitle").text("考题题目不能为空");
            flag = false;
        }
        else {
            $("#spanExamQuesTitle").text("");
        }
        var examQuesTitle = $("#ExamQuesTitle").val();
        if (examQuesTitle.trim().length == 0) {
            $("#spanExamQuesTitle").text("考题题目不能为空");
            flag = false;
        }
        else {
            $("#spanExamQuesTitle").text("");
        }
        var examQuesTime = $("#ExamQuesTime").val();
        if (examQuesTime.trim().length == 0 || !IsPositiveNum(examQuesTime)) {
            $("#spanExamQuesTime").text("考题时长不能为空且须为正整数");
            flag = false;
        }
        else {
            $("#spanExamQuesTime").text("");
        }
        var singleScore = $("#SingleScore").val();
        if (singleScore.trim().length == 0 || !IsPositiveNum(singleScore)) {
            $("#spanSingleScore").text("每道单选题分数不能为空且须为正整数");
            flag = false;
        }
        else {
            $("#spanSingleScore").text("");
        }
        var multipleScore = $("#MultipleScore").val();
        if (multipleScore.trim().length == 0 || !IsPositiveNum(multipleScore)) {
            $("#spanMultipleScore").text("每道多选题分数不能为空且须为正整数");
            flag = false;
        }
        else {
            $("#spanMultipleScore").text("");
        }
        var judgeScore = $("#JudgeScore").val();
        if (judgeScore.trim().length == 0 || !IsPositiveNum(judgeScore)) {
            $("#spanJudgeScore").text("每道对错题分数不能为空且须为正整数");
            flag = false;
        }
        else {
            $("#spanJudgeScore").text("");
        }
        return flag;
    }
</script>